	<div class="content_block">
		<div class="form_tbl" id="slides">
			
		
				<span class="border_d clearfix">
                <h1 style="padding: 16px 0px 16px 0px;">Danh sách phim</h1>
                <table cellpadding="0" cellspacing="0" width="100%">
                	<tr>
                        <td class="form_item" align="center">
                        ID bộ phim cần sửa <input style="width:50px;" id="film_id" type="text" /> <input style="width:50px;cursor:pointer;" onclick="window.location.href = 'index.php?ipos=film&mode=edit&ipid='+document.getElementById('film_id').value;" type="submit" value="SỬA" />
                        ID bộ phim cần xóa <input style="width:50px;" id="del_id" type="text" /> <input style="width:50px;cursor:pointer;" onclick="window.location.href = 'index.php?ipos=film&mode=delete&ipid='+document.getElementById('del_id').value;" type="submit" value="XÓA" />
                        Tìm kiếm <input style="width:260px;" id="key_id" value="<?=$key;?>" type="text" /> <input style="width:50px; cursor:pointer;" onclick="window.location.href = 'index.php?ipos=film&mode=search&key='+document.getElementById('key_id').value;" type="submit" value="TÌM" />
                        </td>
                    </tr>
                </table>
                <form name="media_list" method="post" onSubmit="return check_checkbox();">
                		<table cellpadding="0" cellspacing="0" width="100%">
                        	<tr>
                            <td class="form_item" width="10" align="center">
<input style="width:10px;" type="checkbox" name="chkall" id="chkall" onclick="docheck(document.media_list.chkall.checked,0)" value="checkall">
                            </td>
                            <td class="form_item" width="80">Ảnh</td>
                            <td class="form_item" align="left">Tên bộ phim</td>
                            <td class="form_item" width="120" align="center">Chức năng</td>
                            </tr>
<?php
$arr		=	$db->database("ipos_film.phimid,ipos_film.tenphim,ipos_film.theloai,ipos_film.phimimg","film JOIN ipos_film_info ON (ipos_film_info.phimid = ipos_film.phimid)","$where ORDER BY ipos_film.phimtime DESC LIMIT $limit,$num");
$total		=	$db->database("phimid","film","$where  ORDER BY phimtime DESC");
$total		=	count($total);
if($mode) {
	$urlpg	=	"&mode=$mode";	
}
$pagehtml 	= 	ipos_pages($total,$num,$page,"index.php?ipos=film$urlpg&p=");
for($i=0;$i<count($arr);$i++) {
	if (!preg_match('#://#',$arr[$i][3])) {
		$arr[$i][3]	=	"../".$arr[$i][3];
	}
?>
                        	<tr>
                            <td class="form_item" align="center">
<input style="width:10px;" class="checkbox" type="checkbox" id="checkbox" onclick="docheckone()" name="checkbox[]" value="<?=$arr[$i][0];?>">
                            </td>
                            <td class="form_item" align="center"><img width="51" height="70" src="<?=($arr[$i][3]);?>" /></td>
                            <td class="form_item" align="left">
								<div><strong><a href="index.php?ipos=film&mode=edit&ipid=<?=$arr[$i][0];?>"><?=$arr[$i][1];?></a></strong>
                                <br />» Thể loại: <?=get_category($arr[$i][2]);?></div>
                                <div style="padding-top: 10px;"><a href="index.php?ipos=epfilm&ipid=<?=$arr[$i][0];?>">Quản lý tập phim</a> / <a href="index.php?ipos=addfilm&phimid=<?=$arr[$i][0];?>">Thêm tập phim mới</a></div>
                            </td>
                            <td class="form_item" width="120" align="center">
                            <a href="index.php?ipos=film&mode=edit&ipid=<?=$arr[$i][0];?>">Sửa</a> / <a href="index.php?ipos=film&mode=delete&ipid=<?=$arr[$i][0];?>"  onClick="return ask()">Xóa</a></td>
                            </tr>
<? } ?>
							<tr><td class="form_item" colspan="4" style="text-align: right;"><ul class="pages"><?=$pagehtml;?></ul></td></tr>
                            <tr><td class="form_item" colspan="4">
                            	Với những bộ phim đã chọn: 
                                    <select style="width: 150px;" name="selected_option">
                                        <option value="hot">Phim HoT</option>
                                        <option value="unhot">Bỏ phim HoT</option>
                                        <option value="decu">Phim đề cử</option>
                                        <option value="undecu">Bỏ phim đề cử</option>
                                        <option value="chieurap">Phim chiếu rạp</option>
                                        <option value="unchieurap">Bỏ phim chiếu rạp</option>
                                        <option value="unerror">Phim đã sửa xong!</option>
        							</select>

        						<input style="width: 70px; cursor:pointer;" type="submit" name="do" class=submit value="Thực hiện">
                            </td></tr>
                        </table>
                        
                        </form>
				</span>

			</div>
		</div>
<script>
function ask(){
	if (confirm("Bạn có chắc chắn muốn xóa bộ phim này")) return true;
	return false ;
}
</script>
<?php
if ($_POST['do']) {
	$arr = $_POST['checkbox'];
	if (!count($arr)) die('Lỗi');
	$in_sql = implode(',',$arr);
	if ($_POST['selected_option'] == 'hot') {
		$db->dbupdate("film","phimhot = 1","phimid IN (".$in_sql.")");
		header("Location: index.php?ipos=film");
	}
	elseif ($_POST['selected_option'] == 'unhot') {
		$db->dbupdate("film","phimhot = 0","phimid IN (".$in_sql.")");
		header("Location: index.php?ipos=film");
	}
	elseif ($_POST['selected_option'] == 'decu') {
		$db->dbupdate("film","phimdecu = 1","phimid IN (".$in_sql.")");
		header("Location: index.php?ipos=film");
	}
	elseif ($_POST['selected_option'] == 'undecu') {
		$db->dbupdate("film","phimdecu = 0","phimid IN (".$in_sql.")");
		header("Location: index.php?ipos=film");
	}
	elseif ($_POST['selected_option'] == 'chieurap') {
		$db->dbupdate("film","phimchieurap = 1","phimid IN (".$in_sql.")");
		header("Location: index.php?ipos=film");
	}
	elseif ($_POST['selected_option'] == 'unchieurap') {
		$db->dbupdate("film","phimchieurap = 0","phimid IN (".$in_sql.")");
		header("Location: index.php?ipos=film");
	}
	elseif ($_POST['selected_option'] == 'unerror') {
		$db->dbupdate("film","phimerror = 0","phimid IN (".$in_sql.")");
		header("Location: index.php?ipos=film");
	}
	
	exit();
}
?>